package Encapsulation.封装;


import javax.print.DocFlavor;

interface  PersonBuilder{
    Person buildPerson(String name);
}

class Person{

    private String name;

    public  Person(String name){
        this.name = name;
    }
    public String getName(){
        return  name;
    }
}

public class constrctorPoint {

    public static void printName(String name,PersonBuilder pb){
        String m = pb.buildPerson(name).getName();
        System.out.println(m);
    }

    public static void main(String[] args) {
        printName("赵宇轩",name -> new Person(name));
        printName("赵宇轩",Person::new);
    }
}
